<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    
</body>
<script>
    
    // 空字符为false，非空字符为true
    console.log( Boolean( "hello" ) )
    console.log( Boolean( "false" ) )
    console.log( Boolean( "{}" ) )
    console.log( Boolean( " " ) )
    console.log( Boolean( "" ) )

    console.log( "-------" )
    
    // 0和NaN为false，其他为true
    console.log( Boolean( 0 ) )
    console.log( Boolean( 1 ) )
    console.log( Boolean( -1 ) )
    console.log( Boolean( 1.235246 ) )
    console.log( Boolean( NaN ) )

    console.log( "-------" )
    
    // 对象数组函数，全是true
    console.log( Boolean( {} ) )
    console.log( Boolean( {name:"Admin"} ) )
    console.log( Boolean( [] ) )
    console.log( Boolean( [false, 0] ) )
    console.log( Boolean( function(){} ) )
    console.log( Boolean( function(){console.log(1)} ) )

    console.log( "-------" )

    // undefined和null都是false
    console.log( Boolean( undefined ) )
    console.log( Boolean( null ) )


</script>
</html>